<template>
  <n-modal
    v-model:show="getProps.modalData.show"
    :bordered="false"
    :style="{ width: '400px' }"
    class="custom-card"
    preset="card"
    :mask-closable="false"
  >
    <div style="text-align: center; padding: 10px 0 20px 0">
      <n-text>账户是否已授权？</n-text>
    </div>
    <template #footer>
      <n-space justify="center">
        <x-button type="primary" @click="handleSubmit()">已授权</x-button>
        <x-button @click="handleCancel">未授权</x-button>
      </n-space>
    </template>
  </n-modal>
</template>

<script setup lang="ts">
  import { XButton } from '@/components'
  import { NModal, NSpace, NText, useMessage } from 'naive-ui'
  import { reactive } from 'vue'
  const emits = defineEmits(['success'])
  const props = defineProps({
    modalData: {
      type: Object,
      default: () => ({})
    }
  })
  const message = useMessage()
  const getProps = reactive(props)

  function handleSubmit() {
    getProps.modalData.show = false
    emits('success')
  }
  function handleCancel() {
    window.open(getProps.modalData.redirectUri)
  }
</script>

<style scoped lang="scss"></style>
